<?php

namespace app\server;

use EasyWeChat\Factory;

class WeChatServer
{
    private static $server;

    private static $_instance;

    private function __construct()
    {
//        $this->server = Factory::work($this->config);
    }

    private function __clone()
    {

    }

    public static function getInstance()
    {
        if (! (self::$_instance instanceof self)) {
            self::$_instance = new self();
        }
        return self::$_instance;
    }

    public function server()
    {
        if (!self::$server) {
            self::$server = Factory::work($this->config);
        }
        return self::$server;
    }

    private $config = [
        'corp_id' => 'wwd6c3e7b79a384bed',
        'secret'   => 'lo4WGE0tC2Co1AglMtXzidS2Z2u0XGExIHLFiHrItxo',
        'response_type' => 'array',
        'log' => [
            'level' => 'debug',
            'file' => __DIR__.'/wechat.log',
        ],
    ];
}